#include "monster.h"

s_monster **g_monster = NULL;
/*
** Copy a monster from the general table.
*/
s_monster *init_monster(s_monster *monster)
{
  s_monster *m = malloc(sizeof (s_monster));

  m->health = monster->health;
  m->coord.x = 0;
  m->coord.y = 0;
  m->size.x = monster->size.x;
  m->size.y = monster->size.y;
  m->speed = monster->speed;
  m->alive = 1;
  m->img = monster->img;

  return (m);
}

int create_monster(int i, int health, int cx, int cy,
		   int weapon, int speed, char *skin,
		   int isboss)
{
  s_monster *monst = malloc(sizeof(s_monster));
  SDL_Surface *rec = NULL;

  rec = IMG_Load(skin);
  monst->health = health;
  monst->coord.x = cx;
  monst->coord.y = cy;
  monst->size.x = rec->w;
  monst->size.y = rec->h;
  monst->weapon = NULL;
  monst->speed = speed;
  monst->alive = 1;
  monst->isboss = isboss;
  monst->img = rec;

  weapon = weapon;
  g_monster[i] = monst;
  return (0);
}

int make_monster(void)
{
  g_monster = malloc(50 * sizeof(s_monster*));
  create_monster(0, 1, 50, 50, 0, 10, "src/picture/carrotte.png", 0);
  create_monster(1, 2, 50, 50, 0, 10, "src/picture/ball.png", 0);
  return (0);
}
